package com.lkd.controller;

import com.lkd.dto.VmDto;
import com.lkd.result.PageBean;
import com.lkd.result.Result;
import com.lkd.service.VmService;
import com.lkd.vo.VmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class VmController {

    @Autowired
    private VmService vmService;

    //根据点位id查询
    @GetMapping("/api/vm-service/node/vmList/{nodeId}")
    public Result findByNodeId(@PathVariable Long nodeId) {
        List<VmVo> vmVoList= vmService.findByNodeId(nodeId);
        return Result.success(vmVoList);
    }

    //设备搜索
    @GetMapping("/api/vm-service/vm/search")
    public Result findByPage(VmDto dto){
        PageBean<VmVo> pageBean = vmService.findByPage(dto);
        return Result.success(pageBean);
    }
}
